$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'sys/count/list',
        datatype: "json",
        colModel: [			
        	{ label: '类型', name: 'type', width: 50, 
				formatter:function(value,options,row){
					if(value==1){
						return '<span>单选</span>';
					}else if(value==2){
						return '<span>多选</span>';
					}else{
						return '<span>简答</span>';
					}
					}},
			{ label: '人数', name: 'Mumbercount', width: 90 },
			{ label: '所占百分比', name: 'percent', width: 90 },
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});


var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			
		},
		showList: true,
		title:null,
		optionval:{
			
		},
		
	},
	methods: {
		query: function () {
			vm.reload();
		},
		
		reload: function () {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{ 
                postData:{'name': vm.q.value},
                page:page
            }).trigger("reloadGrid");
		}
	}
});